<template>
	<view class="content">
		<view class="money">
			支付金额
		</view>
		<view class="price">
			<text style="font-size:44rpx;margin-left: 6rpx;">¥</text>{{money}}
		</view>
		<!-- <view class="time">
			请在  <text style="color:#f4d27d">00:59:28</text>  内完成支付，预期订单将被取消
		</view> -->
		<view class="cards">
			<view class="card" @click="show = !show">
				<image class="card-img" :src="icon1" alt=""></image>
				<text class="card-text">{{text}}</text>
				<view class="card-tips" v-if="is_show">
					{{money_tips}}
				</view>
				<image class="card-dui" v-if="show" :src="icon2" alt=""></image>
				<view class="card-duis" v-else>

				</view>
			</view>
			<view class="btn" @click="btnFn">
				立即支付
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				appId: '',
				path: '',
				icon1: this.$imgUrl + 'webview/yunshanfu.png',
				icon2: this.$imgUrl + 'webview/duigou.png',
				show: false,
				money: '',
				state:'1', //1半屏 2全屏
				text:'',//云闪付免密
				money_tips:'',//满5减2
				is_show:1,//1显示 2不显示
				
			}
		},
		onLoad(options) {	
			const data = JSON.parse(decodeURIComponent(options.query))
			this.appId = data.appid;
			this.path = data.path;
			this.money = data.money;
			this.status = data.status;
		},
		onHide() {
			if (this.status == 1) {
				this.$utils.jumpWebview('https://api.cd1a.cn/h5/app_li/#/memberPlus?status=3');	
			} else if (this.status == 2) {
				uni.reLaunch({
					url: "/pages/charge/start?status=2"
				})
			} else if (this.status == 3) {
				uni.reLaunch({
					url: "/pages/person/personalCenter"
				})
			}
		},
		onShow() {
			this.getList();	
		},
		methods: {
			getList() {
				this.$u.api.gethalfscren().then(res => {
					console.log(res,'res');
					this.state = res.data.state;
					this.text = res.data.text;
					this.money_tips = res.data.money_tips;
					this.is_show = res.data.is_show == 1;
				})
			},
			// 0不跳转 1本地 2 H5  3跳转小程序
			btnFn() {
				if (!this.show) {
					this.$utils.toast('请选择支付方式');
				} else {
					if(this.state == 1){
						this.$utils.halfScreen(this.appId, this.path);
					}else{
						uni.navigateToMiniProgram({
							appId: this.appId,
							path: this.path,
							extraData: {
								'data1': 'test'
							},
							success(res) {
						  console.log('跳转成功');
							}
						}) 
					}
					
				}

				
			}

		}
	}
</script>
<style>
	page {
		height: 100%;
		background: #f5f5f5
	}
</style>
<style scoped>
	.content {
		overflow: hidden;
	}

	.money {
		margin-top: 60rpx;
		text-align: center;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		color: #666666;
	}
	.price {
		text-align: center;
		font-size: 88rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		color: #000000;
	}
	.moneys {
		font-size: 60rpx;
	}

	.time {
		margin-top: 20rpx;
		color: #c7c7c7;
		text-align: center;
	}

	.card {
		margin: 30rpx auto 0;
		width: 92%;
		height: 120rpx;
		background-color: #FFFFFF;
		padding: 40rpx 30rpx;
	}


	.card-img {

		width: 40rpx;
		height: 40rpx;
		vertical-align: middle
	}

	.card-text {

		margin: 0 30rpx 0 30rpx;
		color: black;
		font-size: 30rpx;
		font-weight: 600;
		vertical-align: middle
	}

	.card-dui {
		float: right;
		display: inline-block;
		width: 40rpx;
		height: 40rpx;
		background: linear-gradient(to bottom, #fd2c37, #ff5521);
		color: #f9f9f9;
		border-radius: 50%;
		text-align: center;
		line-height: 40rpx;
		vertical-align: middle
	}

	.card-tip {
		font-size: 40rpx;
		display: inline-block;
		transform: scale(1.2, .4);
	}

	.card-duis {
		float: right;
		display: inline-block;
		width: 40rpx;
		height: 40rpx;
		border-radius: 50%;
		border: 2rpx solid #c7c7c7;
		vertical-align: middle;
	}

	.btn {
		margin-top: 540rpx;
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 40rpx;
		background: linear-gradient(to right, #ff1c40, #ff6319);
		color: #fde7e1;
		font-size: 30rpx;
	}
	.card-tips {
		padding:0 20rpx;
		height: 45rpx;
		border-radius: 45rpx;
		line-height: 45rpx;
		color: #FFFFFF;
		font-size: 20rpx;
		display: inline-block;
		background-color: #ff1c40;
		vertical-align: middle;
		
	}
</style>